package com.tanhua.admin.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tanhua.model.domain.Analysis;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

@Repository
public interface AnalysisMapper extends BaseMapper<Analysis> {
    //查询累计用户数
    @Select("select sum(num_registered) from tb_analysis_by_day")
    Integer queryCumulativeUsers();
    //近30天活跃用户
    @Select("SELECT sum(num_active) FROM tb_analysis_by_day where DATE_SUB(CURDATE(), INTERVAL 30 DAY) <= date(record_date)")
    Integer getNumActivePassMonth();
    //近7天活跃用户
    @Select("SELECT SUM(num_active) FROM tb_analysis_by_day where DATE_SUB(CURDATE(), INTERVAL 7 DAY) <= date(record_date)")
    Integer getNumActivePassWeek();


}
